package com.xueshishasha.oa.common.utils;

import java.util.List;
@SuppressWarnings("unchecked")
public class PageModel {
	private int currentPage; 	//当前页
	private boolean hasNext;  //是否有下一页
	private boolean isFirst; //是否是第一页
	private List list; //结果
	private int pageCount; //页数
	private int pageSize; //每页大小
	private int totalCount;  //总行数
	
	

	public PageModel() {
	}

	public PageModel(List list, int totalCount, int pageSize, int currentPage) {
		this.totalCount = totalCount;
		this.list = list;
		this.pageSize = pageSize;
		this.currentPage = currentPage;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public boolean getHasNext() {
		return this.currentPage < getPageCount();
	}


	public int getPageCount() {
		return totalCount % pageSize == 0 ? totalCount / pageSize : totalCount
				/ pageSize + 1;
	}

	public int getPageSize() {
		return pageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public boolean getIsFirst() {
		return this.currentPage == 1;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public void setIsFirst(boolean isFirst) {
		this.isFirst = isFirst;
	}

	public void setHasNext(boolean hasNext) {
		this.hasNext = hasNext;
	}


	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public void setFirst(boolean isFirst) {
		this.isFirst = isFirst;
	}

}
